package com.chenl.provider.DEMOS.设计模式.测试设计模式;



import com.alibaba.fastjson2.JSONObject;

import java.util.*;
import java.util.stream.Collectors;

public class test {
    public static void main(String[] args) {
        List<Man> list=new ArrayList<>();
        list.add(new Man("zs","23"));
        list.add(new Man("ls",null));
        Map<String, String> collect = list.stream().filter(e->e.getAge()!=null).collect(Collectors.toMap(Man::getName, Man::getAge));

        if (collect instanceof HashMap){
            System.out.println(1);
        }else if (collect instanceof TreeMap){
            System.out.println(2);
        }
        System.out.println(collect);
//        Map<String,String>map=new HashMap<>();
//        map.put("1",null);
//        System.out.println(map);
    }
    public static Person test1() {
        Person man=new Man2("张三","23");
        System.out.println(JSONObject.toJSONString(man));
        return man;
    }

    public static void method(Person person) {
        System.out.println(JSONObject.toJSONString(person));
    }
}
